/**
 * Por Joshua
 * Descripcion o proposito
 * @class namespace
 *
 * @extends clasePadre
 * @autor Ing. Josue Hernandez Gomez<br>
 *        joshua@extjs.mx<br>
 *        http://www.joshua.com.mx
 * @fecha 12/8/12 11:20 PM. Mexico DF
 */




Ext.apply(Ext.form.VTypes,{
	capitalize:function(val,field) {
				var words = val.split(/\s/);
					for (i = 0; i < words.length; i++) {
						words[i] = Ext.util.Format.capitalize(words[i]);
					}
				field.setRawValue(words.join(' '));
				return true;
	},
    lowercaseMask:/[-_.a-z0-9]/,
	lowercaseText:'Texto no permitido.',
        lowercase:function(val,field) {
				var words = val.split(/\s/);
					for (i = 0; i < words.length; i++) {
						words[i] = Ext.util.Format.lowercase(words[i]);
					}
				field.setRawValue(words.join(' '));
				return true;
	},
	numMask:/[\d\$.]/,
	num:function(val,field){
		  			return val;
	},

	password: function(val, field){
		   	  this.passwordText = 'Seis caracteres minimo.';
		      return(val.length >= 6);
	},
	vpasswordText : 'Las contrase&#243as no coinciden',
	vpassword : function(val, field) {
		if (field.initialPassField) {
			var pwd = Ext.get(field.initialPassField).getValue();
			return (val == pwd);
		}
		return true;
	},
	nombreMask:/[-_.a-zA-Z0-9]/,
	nombreText:'Debe empezar con un letra',
	nombre:function(val,field){
		var regExp=/^[a-zA-Z][-_.a-zA-Z0-9]{0,30}$/;
		return regExp.test(val);
	},

    /**
     *  Vtype definido para los campos telefonicos
     * */
    telefonoMask:/[0-9]/,
	telefonoText:'Se requieren 10 caracteres',
	telefono:function(val,field){
		var regExp=/^[0-9]{10}$/;
		return regExp.test(val);
	}
});